package com.i2863.receiptinterface.service.impl;

import com.i2863.receiptinterface.entity.Activity;
import com.i2863.receiptinterface.mapper.ActivityMapper;
import com.i2863.receiptinterface.service.ActivityService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class ActivityServiceImpl implements ActivityService {

    @Resource
    private ActivityMapper activityMapper;

    @Override
    public Activity findOne(Integer Id) {
        return activityMapper.selectByPrimaryKey(Id);
    }

    @Override
    public List<Activity> findAll() {
        return activityMapper.selectAll();
    }

    @Override
    public void update(Activity activity) {
        activityMapper.updateByPrimaryKey(activity);
    }

    @Override
    public void delete(Integer Id) {
        activityMapper.deleteByPrimaryKey(Id);
    }

    @Override
    public List<Integer> findByStatusAndSiteAndTime(Integer activityStatus, Integer siteId) {
        return activityMapper.findByStatusAndSiteAndTime(activityStatus,siteId);
    }

    @Override
    public List<Activity> findOneByNow(Integer siteId) {
        return activityMapper.findOneByNow(siteId);
    }

    @Override
    public void add(Activity activity) {
        activityMapper.insert(activity);
    }

    @Override
    public List<Integer> listEndActivity(Integer siteId) {
        return activityMapper.listEndActivity(siteId);
    }
}
